Skip to content

fix: repair all failing tests in utility library#214

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2472-1781589098
Open

fix: repair all failing tests in utility library#214
stooit wants to merge 1 commit into
mainfrom
quantcode/e2e-tier1-2472-1781589098

Conversation

@stooit

@stooit stooit commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes all 16 failing tests across the TypeScript utility library. The suite now reports 60 pass / 0 fail (was 44 pass / 16 fail). No test files were modified and no dependencies were added.

Changes

File Fix
src/calculator.ts divide throws Error("Division by zero") when the divisor is 0 instead of returning Infinity.
src/string-utils.ts wordCount splits on a whitespace regex so consecutive spaces don't create empty tokens; truncate implemented (word-boundary cut, ellipsis counts toward maxLength, returns input unchanged when within limit).
src/task-manager.ts remove returns false for unknown ids; update applies partial updates and returns false for unknown ids; sortBy orders priority high→medium→low and createdAt oldest-first (non-mutating).
src/date-utils.ts formatRelative uses Math.round for the day boundary so 36 hours ago renders as "2 days ago".
src/validator.ts isEmail accepts long TLDs (e.g. user@example.museum); isUrl accepts URLs with a port via the URL parser.

Verification

  • bun test60 pass / 0 fail, 70 expect() calls.
  • Reviewed via the review subagent: all fixes confirmed as genuine corrections (not test-gaming).

Assumptions

  • Followed the test-specified semantics exactly (Math.round relative-day formatting, Error on divide-by-zero).
  • No out-of-scope changes; behaviour matches the existing test expectations.

🤖 Generated with QuantCode Agent

- calculator: divide now throws on division by zero instead of returning Infinity
- string-utils: wordCount splits on whitespace regex; implement truncate
- task-manager: implement remove/update return values and sortBy ordering
- date-utils: formatRelative uses Math.round for day boundary (36h -> 2 days)
- validator: isEmail accepts long TLDs; isUrl accepts ports via URL parser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant